<?php
/**
* Display the transactions in a table fashion
*
* @author       Fabrice Douteaud <clearbudget@douteaud.com>
* @package      snippets
* @access       public
*/

/***********************************************************************

  Copyright (C) 2008  Fabrice douteaud (clearbudget@douteaud.com)

    This file is part of ClearBudget.

    ClearBudget is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    ClearBudget is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with ClearBudget.  If not, see <http://www.gnu.org/licenses/>.


************************************************************************/
//$db = class_db::getInstance();
$report = class_report::getInstance();
?>
<table class="tableReport" onMouseOver="javascript:trackTableHighlight(event, '#E6EAE9');" onMouseOut="javascript:highlightTableRow(0);">
<caption><?php echo $title; ?></caption>
<tr>
  <th><?php echo $keys->text_id; ?></th>
  <th><?php echo $keys->text_amount; ?></th>
  <!--<th><?php echo $keys->text_Debit; ?></th>-->
  <th><?php echo $keys->text_categoryName; ?></th>
  <th><?php echo $keys->text_payee; ?></th>
  <th><?php echo $keys->text_comments; ?></th>
  <th><?php echo $keys->text_operationDate; ?></th>
  <th>&nbsp;</th>
</tr>
<?php
  foreach($results as $result) {
  // presentation row
  echo '<tr id="tr-'.$result['id'].'">';
  echo '<td class="category">'.$result['id'].'</td>';
  echo '<td>'.$report->formatNumber($result['amount']).'</td>';
  //echo '<td>'.$result['debit'].'</td>';
  echo '<td>'.$report->getCategoryName($result['category']).'</td>';
  echo '<td>'.$result['payee'].'<br/>'.$result['memo'].'</td>';
  echo '<td>';
  if($result['comments'] != '') echo '<i>'.$result['comments'].'</i>';
  else echo '-';
  echo '</td>';
  echo '<td>'.strftime('%A %d %B %Y', strtotime($result['operationDate'])).'</td>';
  echo '<td>';
  echo '<a href="#" action="editTransaction_id='.$result['id'].'" id="edit-'.$result['id'].'">'.$keys->text_edit.'</a>';
  echo '</td>';
  echo '</tr>';
  
  }
?>
</table>
